package com.yanqu.road.logic.rank;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class UnionRankMsgModelGroup {
    private int activityId;
    private long endTime;
    private Map<Integer, UnionRankMsgModel> modelMap = new ConcurrentHashMap<>();

    public UnionRankMsgModelGroup(int activityId, long endTime) {
        this.activityId = activityId;
        this.endTime = endTime;
    }

    public UnionRankMsgModel getUnionRankMsgModel(int groupId) {
        UnionRankMsgModel model = modelMap.get(groupId);
        if (null == model) {
            synchronized (modelMap) {
                model = modelMap.get(groupId);
                if (null == model) {
                    model = new UnionRankMsgModel(groupId, activityId, endTime);
                    modelMap.put(groupId, model);
                }
            }
        }
        return model;

    }


    public long getEndTime() {
        return endTime;
    }

    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }

    public int getActivityId() {
        return activityId;
    }
}
